cmake_minimum_required(VERSION 3.20) # 需要 CMake 3.14 或更高版本
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)


project(MiniYijinjingDemo)

set(CMAKE_CXX_STANDARD 17)

# 添加 spdlog 依赖
# 假设 spdlog 位于 third_party/spdlog 目录下
set(SPDLOG_DIR ${CMAKE_SOURCE_DIR}/third_party/spdlog)
include_directories(${SPDLOG_DIR}/include)

# 添加 mini_yijinjing 库
add_library(mini_yijinjing
    mini_yijinjing/journal/PageProvider.h
    mini_yijinjing/journal/PageSocketHandler.h
    mini_yijinjing/journal/PageSocketStruct.h
    mini_yijinjing/journal/PageUtil.h
    mini_yijinjing/journal/Timer.h
    mini_yijinjing/journal/Frame.hpp
    mini_yijinjing/journal/FrameHeader.h
    mini_yijinjing/journal/IJournalVisitor.h
    mini_yijinjing/journal/Journal.h
    mini_yijinjing/journal/JournalHandler.h
    mini_yijinjing/journal/JournalReader.h
    mini_yijinjing/journal/JournalWriter.h
    mini_yijinjing/journal/Page.h
    mini_yijinjing/journal/PageCommStruct.h
    mini_yijinjing/journal/PageHeader.h
    mini_yijinjing/journal/PageServiceTask.h
    mini_yijinjing/journal/PageEngine.h
    mini_yijinjing/journal/Hash.hpp
    mini_yijinjing/journal/YJJ_DECLARE.h
    mini_yijinjing/journal/constants.h
    mini_yijinjing/journal/JournalHandler.cpp
    mini_yijinjing/journal/JournalReader.cpp
    mini_yijinjing/journal/JournalWriter.cpp
    mini_yijinjing/journal/LocalPageProvider.cpp
    mini_yijinjing/journal/Page.cpp
    mini_yijinjing/journal/PageUtil.cpp
    mini_yijinjing/journal/Timer.cpp
    mini_yijinjing/journal/Journal.cpp
    mini_yijinjing/journal/PageEngine.cpp
    mini_yijinjing/journal/PageServiceTask.cpp
)

target_include_directories(mini_yijinjing PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/mini_yijinjing)

# 添加 spdlog 的头文件路径
target_include_directories(mini_yijinjing PUBLIC ${SPDLOG_DIR}/include)

# 添加可执行文件
add_executable(demo demo.cpp)
target_link_libraries(demo mini_yijinjing)